pp108 : changeOpenIcon Method

changeOpenIcon Method


This method changes the icon of the tree item which has to be displayed when the node is in the expanded state.

Syntax

treeID.root.changeOpenIcon([surl])

When called from a node other than root, the syntax is as follows:
treeNode.changeOpenIcon([surl])

Parameters

Parameter

Description

surl

Required. String that denotes the URL of the icon.


Return Value


No return value.

Remarks


This function should be applied only to a node (a tree item with a "+" sign before it indicating that the item can have children under it).

The changeOpenIcon function is called at runtime to change the icon of the URL in its expanded state. However, to change the same icon of a static item in the tree, one can set the property openIcon to a valid URL.

Although the TreeItem can have several <icon> tags, it can have only one <openIcon> tag defined.

Example


The following example shows how the above method is used.

//Function called when a shortcut menu is clicked on the selected node
function contextSetNewIcon()
{
    //Get the exact item
    var item = event.activeElement.getTreeItem();
    //Change the icon
    item.changeOpenIcon('/cordys/wcp/images/bookopen.gif');
    //Expand the item to have a view of the changed icon
    item.expand();
}

See Also


tree